﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace elsimulatorcsharp
{
    class Person
    {
        private static int peopleCount = 0;

        private static String[] nameList = {"Andrew", "Nathan", "Paul", "Andrea", "Sam", "Frank", "Martha", "Eric",
        "Julie", "Craig", "Stuart", "Kim", "John", "Randy", "Kuda"};
        private static Random rand = new Random();
        private String name;

        private DateTime timeFinished;

        private bool finished = false;

        private short floorDest;

        private int index;

        public Person(short fD)
        {
            this.name = nameList[Math.Abs(rand.Next() % (nameList.Length))];
            this.index = peopleCount++;
            this.floorDest = fD;
        }

        // Functions
        protected void SetFloorDest(byte fD)
        {
            this.floorDest = fD;
        }

        // Getters and setters
        public short GetFloorDest()
        {
            return this.floorDest;
        }

        public void SetFinished()
        {
            this.finished = true;
            this.timeFinished = new DateTime();
        }

        public bool IsFinished()
        {
            return this.finished;
        }

        public int TimeSinceFinish()
        {
            return (int)(DateTime.Now.Millisecond - this.timeFinished.Millisecond);
        }

        public int GetIndex()
        {
            return this.index;
        }
    }
}
